{extend name="public/base"}

{block name="title"}
添加资金账户
{/block}

{block name="style"}
{css href="/static/wechat/css/wallet.css" /}
{/block}

{block name="body"}
<div class="pageControl addBankCard">
    <div class="msui_nav msui_navTop">
        <a class="msui_navTop-back" href="javascript:history.back();"><i class="micon-back"></i></a>
        <h1 class="msui_navTop-title">添加资金账户</h1>
    </div>
    <div class="weui-top">
        <div class="weui-tab">
            <!--<div class="weui-navbar">-->
            <!--<a class="weui-navbar__item {eq name='member_fund_account.type|default=3' value='1' }weui-bar__item&#45;&#45;on{/eq}" href="#tab1">-->
            <!--支付宝-->
            <!--</a>-->
            <!--<a class="weui-navbar__item {eq name='member_fund_account.type|default=3' value='2' }weui-bar__item&#45;&#45;on{/eq}" href="#tab2">-->
            <!--微信-->
            <!--</a>-->
            <!--<a class="weui-navbar__item {eq name='member_fund_account.type|default=3' value='3' }weui-bar__item&#45;&#45;on{/eq}" href="#tab3">-->
            <!--银行卡-->
            <!--</a>-->
            <!--</div>-->
            <div class="weui-tab__bd">
                <div id="tab1" class="weui-tab__bd-item {eq name='member_fund_account.type|default=3' value='1' }weui-tab__bd-item--active{/eq}">
                    <form action="?" method="post" class="add_bank_form">
                        <input id="zhifubao" type="hidden" name="account_type" value="1">
                        <div class="weui-cell">
                            <div class="weui-cell__hd"><label class="weui-label">姓名</label></div>
                            <div class="weui-cell__bd">
                                <input class="weui-input" type="text" name="householder" value="{$certification.proposer|default=''}"  placeholder="请输入姓名">
                            </div>
                        </div>
                        <div class="weui-cell">
                            <div class="weui-cell__hd"><label class="weui-label">身份证号</label></div>
                            <div class="weui-cell__bd">
                                <input class="weui-input" type="text" name="id_card" value="{$certification.card_no|default=''}" placeholder="请输入身份证号">
                            </div>
                        </div>
                        <div class="weui-cell">
                            <div class="weui-cell__hd"><label class="weui-label">支付宝帐号</label></div>
                            <div class="weui-cell__bd">
                                <input class="weui-input" type="text" name="account" value="{$member_fund_account.account|default=''}" placeholder="请输入支付宝帐号">
                            </div>
                        </div>
                        <div class="weui-cell">
                            <div class="weui-cell__hd"><label class="weui-label">手机号</label></div>
                            <div class="weui-cell__bd">
                                <input class="weui-input" type="text" name="phone"  value="{$member_fund_account.phone|default=''}" placeholder="请输入银行卡预留手机号">
                            </div>
                        </div>
                        <input type="hidden" name="fund_account_id" value="{$member_fund_account.id|default=0}">
                        <div class="msui_button">
                            <div class="msui_button-hd">
                                <p>请输入支付宝帐号信息</p>
                            </div>
                            <div class="msui_button-bd">
                                <a class="msui_button-content add_send">确认提交</a>
                            </div>
                        </div>
                    </form>
                </div>
                <div id="tab2" class="weui-tab__bd-item {eq name='member_fund_account.type|default=3' value='2' }weui-tab__bd-item--active{/eq}">
                    <form action="?" method="post" class="add_bank_form">
                        <input id="weixin" type="hidden" name="account_type" value="2">
                        <div class="weui-cell">
                            <div class="weui-cell__hd"><label class="weui-label">姓名</label></div>
                            <div class="weui-cell__bd">
                                <input class="weui-input" type="text" name="householder" value="{$member_fund_account.householder|default=''}"  placeholder="请输入姓名">
                            </div>
                        </div>
                        <div class="weui-cell">
                            <div class="weui-cell__hd"><label class="weui-label">身份证号</label></div>
                            <div class="weui-cell__bd">
                                <input class="weui-input" type="text" name="id_card" value="{$member_fund_account.id_card|default=''}" placeholder="请输入身份证号">
                            </div>
                        </div>
                        <div class="weui-cell">
                            <div class="weui-cell__hd"><label class="weui-label">微信帐号</label></div>
                            <div class="weui-cell__bd">
                                <input class="weui-input" type="text" name="account" value="{$member_fund_account.account|default=''}" placeholder="请输入微信帐号">
                            </div>
                        </div>
                        <div class="weui-cell">
                            <div class="weui-cell__hd"><label class="weui-label">手机号</label></div>
                            <div class="weui-cell__bd">
                                <input class="weui-input" type="text" name="phone"  value="{$member_fund_account.phone|default=''}" placeholder="请输入银行卡预留手机号">
                            </div>
                        </div>
                        <input type="hidden" name="fund_account_id" value="{$member_fund_account.id|default=0}">
                        <div class="msui_button">
                            <div class="msui_button-hd">
                                <p>请输入微信帐号信息</p>
                            </div>
                            <div class="msui_button-bd">
                                <a class="msui_button-content add_send">确认提交</a>
                            </div>
                        </div>
                    </form>
                </div>
                <div id="tab3" class="weui-tab__bd-item {eq name='member_fund_account.type|default=3' value='3' }weui-tab__bd-item--active{/eq}">
                    <form action="?" method="post" class="add_bank_form">
                        <input id="yinhangka" type="hidden" name="account_type" value="3">
                        <div class="weui-cell">
                            <div class="weui-cell__hd"><label class="weui-label">姓名</label></div>
                            <div class="weui-cell__bd">
                                <input class="weui-input" type="text" name="householder"
                                       value="{$certification.proposer|default=''}"  placeholder="请输入姓名"
                                       {notempty name="certification"}readonly{/notempty}>
                            </div>
                        </div>
                        <div class="weui-cell">
                            <div class="weui-cell__hd"><label class="weui-label">身份证号</label></div>
                            <div class="weui-cell__bd">
                                <input class="weui-input" type="text" name="id_card"
                                       value="{$certification.card_no|default=''}" placeholder="请输入身份证号"
                                       {notempty name="certification"}readonly{/notempty}>
                            </div>
                        </div>
                        <div class="weui-cell">
                            <div class="weui-cell__hd"><label class="weui-label">银行卡号</label></div>
                            <div class="weui-cell__bd">
                                <input class="weui-input" type="text" name="account" value="{$member_fund_account.account|default=''}" placeholder="请输入银行卡号">
                            </div>
                        </div>
                        <div class="weui-cell">
                            <div class="weui-cell__hd"><label class="weui-label">手机号</label></div>
                            <div class="weui-cell__bd">
                                <input class="weui-input" type="text" name="phone"  value="{$member_fund_account.phone|default=''}" placeholder="请输入银行卡预留手机号">
                            </div>
                        </div>
                        <input type="hidden" name="fund_account_id" value="{$member_fund_account.id|default=0}">
                        <div class="msui_button">
                            <div class="msui_button-hd">
                                <p>银行卡仅支持储蓄卡,请不要填写信用卡</p>
                            </div>
                            <div class="msui_button-bd">
                                <a class="msui_button-content add_send background3">确认提交</a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

</div>
<!-- loading toast -->
<div id="loadingToast" style="display:none;">
    <div class="weui-mask_transparent"></div>
    <div class="weui-toast" style="opacity: 1; visibility: visible;">
        <i class="weui-loading weui-icon_toast"></i>
        <p class="weui-toast__content">正在提交...</p>
    </div>
</div>
{/block}
{block name="javascript"}
<script>
    $(function () {
        $(".add_send").click(function () {
            $('#loadingToast').fadeIn(100);
            var _obj = $(".weui-tab__bd-item--active .add_bank_form");
            $.ajax({
                type : _obj.attr('method'),
                url : _obj.attr('action'),
                data : _obj.serialize(),
                dataType : 'json',
                success : function (msg) {
                    console.log(msg);
                    $('#loadingToast').fadeOut(100);
                    if (msg.code != 200) {
                        var code = msg.code;
                        $.alert(error_code[code]);
                    } else {
                        $.alert('绑定成功');
                        setTimeout(function () {
                            window.location.href="{$url}";
                        }, 800);
                    }
                }
            });
        });
    });
</script>
{/block}

